package com.hongning.railway.ui.main.fragments.home.itemviewmodel;

import android.databinding.ObservableField;
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.hongning.railway.app.Constant;
import com.hongning.railway.entity.MineItemBean;
import com.hongning.railway.ui.categorylistnews.CategoryListNewsFragment;
import com.hongning.railway.ui.main.cadremanager.CadreManagerFragment;
import com.hongning.railway.ui.main.fragments.MineViewModel;
import com.hongning.railway.ui.main.fragments.cadremanagement.CadreManagementFragment;
import com.hongning.railway.ui.main.fragments.threesessionsandonelesson.ThreesessionSanDoneLessonFragment;
import com.hongning.railway.ui.main.fragments.threesessionsandonelesson.ThreesessionSanDoneLessonMsgFragment;
import com.hongning.railway.ui.main.fragments.threesessionsandonelesson.ThreesessionSanDoneLessonViewModel;
import com.hongning.railway.ui.main.mine.AboutActivity;
import com.hongning.railway.ui.main.mine.experience.ExperienceFragment;
import com.hongning.railway.ui.main.mine.partcheck.PartCheckMainFragment;
import com.hongning.railway.ui.main.mine.partymember.PartyMemberMainFragment;
import com.hongning.railway.ui.main.mine.score.MainScoreFragment;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class MineItemViewModel  extends ItemViewModel<MineViewModel> {
    public ObservableField<MineItemBean> mineItems= new ObservableField<>();
    public MineItemViewModel(@NonNull MineViewModel viewModel,MineItemBean mineItemBean) {
        super(viewModel);
        mineItems.set(mineItemBean);

    }
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
//            Bundle bundle = new Bundle();
//            bundle.putParcelable(CategoryListNewsFragment.PARAMS_CATEGORY_ID,item.get());
            switch (mineItems.get().getCode()){
                case "gbgl":

                    viewModel.startContainerActivity(CadreManagementFragment.class.getName());
                    break;
                case "gbcp":
                    viewModel.startContainerActivity(CadreManagerFragment.class.getName());
                    break;
                case "shyk":
                    viewModel.startContainerActivity(ThreesessionSanDoneLessonFragment.class.getName());
                    break;
                case "wdxx":
                    viewModel.startContainerActivity(ThreesessionSanDoneLessonMsgFragment.class.getName());
                    break;
                case "gyapp":
                    viewModel.startActivity(AboutActivity.class);
                    break;
                case "jfph":
                    Bundle bundle = new Bundle();
                    bundle.putParcelable(Constant.EXTRA_DATA,viewModel.getScoreInfo());
                    viewModel.startContainerActivity(MainScoreFragment.class.getName(),bundle);
                    break;
                case "xdth":
                    viewModel.startContainerActivity(ExperienceFragment.class.getName());
                    break;
                case "djkh":
                    viewModel.startContainerActivity(PartCheckMainFragment.class.getName());
                    break;
                case"dycp":
                    viewModel.startContainerActivity(PartyMemberMainFragment.class.getName());
                    break;

            }

        }
    });


}
